const nextConfig = {
  typescript: {
    ignoreBuildErrors: true,/// 忽略编译的ts报错
  },
  eslint: {
    // Warning: This allows production builds to successfully complete even if
    // your project has ESLint errors.
    ignoreDuringBuilds: true,
  },
  // 启用代理配置，让前端通过相对路径访问后端
  async rewrites() {
    return [
      {
        source: '/api/:path*',
        destination: 'http://localhost:3888/api/:path*',
      },
      {
        source: '/health',
        destination: 'http://localhost:3888/health',
      },
    ];
  },
  // 添加图像域名配置
  images: {
    domains: ['word-memorization-1350150054.cos.ap-guangzhou.myqcloud.com'],
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'img.daisyui.com',
        port: '',
        pathname: '/**',
      },
    ],
  },
  // 压缩配置
  compress: true,
  // async redirects() {
  //   return [
  //     // Basic redirect
  //     {
  //       source: '/',
  //       destination: '/class',
  //       permanent: true,
  //     },
  //   ]
  // },
  compiler: {
    removeConsole: process.env.NODE_ENV === 'production' 
      ? {
          exclude: ['error', 'warn'],
          inclue: ['log', 'info', 'debug']
        }
      : false
  },
}

export default nextConfig
